package cn.e2win.biz.sys;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.e2win.base.entity.BaseEntity;
import cn.e2win.base.json.vo.Pager;
import cn.e2win.biz.base.BaseDAO;
import cn.e2win.biz.base.BaseService;


@Service
public class LogsService  extends BaseService{
	 

	@Autowired
	private LogsDao logsDao;
	
	@Override
	public BaseDAO initDao() {
		return logsDao;
	}

	public void pagerLogs(Pager pager){
		logsDao.pagerLogs(pager);
	}

	public List<Map<String, Object>> getLogsList(BaseEntity entity){
		if(entity!=null && entity.getId()!=null){
			Pager pager = new Pager();
			pager.setReturnAll(true);
			pager.getScMap().put("entityType", entity.getClass().getSimpleName());
			pager.getScMap().put("entityId", entity.getId()+"");
			
			logsDao.pagerLogs(pager);
			return pager.getResultList();
		}
		return null;
	}
}